# -*- coding: utf-8 -*-
"""
author:码同学 极光
date:2023-06-10
desc: 
sample: 
"""
#标准的对象定义大写开头  模版
class Person:
    #
    def __info(self):
        print(self.name,self.age)

    def send(self):
      print("send",self.__info())

    # def __init__(self) -> None:
    #     print("init 1")

    #对象初始化方法，定义属性  构造方法
    def __init__(self,name,age) -> None:
        print("init 2----")
        self.name =name
        self.age = age

    def __str__(self) -> str:
        return f"{self.name},age=={self.age}"


#继承 构造方法都直接继承  子类  子类也可以重写父类方法
class Stu(Person):
    # 多态(改写) 我可以重写父类方法
    # def info(self):
    #     print(self.score,super().info())

    # def info1(self):
    #     print(self.name,self.age,self.score)

    # def __init__(self, name, age,score) -> None:
    #     self.score = score
    #     super().__init__(name, age)

    # def __init__(self, name, age,score) -> None:
    #     self.score = score
    #     self.name = name
    #     self.age = age
    pass


if __name__ == '__main__':
    p1= Person("zhangsan1",10)
    print(p1) #地址信息

    p1.name2

    p2 = Person("zhangsan1", 10)
    print(p2)  # 地址信息

    #对象转字典 json
    print(p2.__dict__)



    # st1= Stu("zhangsan2",10)
    # print(st1.__name)







